package dao

import (
	"dc-news/common/utils"
	"dc-news/dao/db"
	"dc-news/dao/model"
	"dc-news/entity"
)

// CreateComment 创建评论
func CreateComment(comment *entity.Comments) (err error) {
	return db.CreateComment(comment)
}

// GetCommentById 通过id查询评论
func GetCommentById(id int, userID int) (comment *model.Comment, err error) {
	return db.GetCommentById(id, userID)
}

// GetNewsCommentsById 通过新闻id获取新闻评论
func GetNewsCommentsById(id int, userId int) (comments *[]model.Comment, err error) {
	return db.GetNewsCommentsById(id, userId)
}

// GetCommentCommentsById 通过评论id获取评论的评论
func GetCommentCommentsById(id int, userId int) (comments *[]model.Comment, err error) {
	return db.GetCommentCommentsById(id, userId)
}

// SetCommentLikesByIdAndType 通过用户id和评论id设置评论赞踩状态
func SetCommentLikesByIdAndType(userId int, commentId int, likesType int) (err error) {
	return db.SetCommentLikesByIdAndType(userId, commentId, likesType)
}

// CancelLikesCommentById 通过id取消赞/踩
func CancelLikesCommentById(commentId int, userId int) (err error) {
	return db.CancelLikesCommentById(commentId, userId)
}

// GetUserCommentListById 获取用户评论列表
func GetUserCommentListById(userId int, p *utils.Pagination) (comments *[]model.UserComment, err error) {
	return db.GetUserCommentListById(userId, p)
}

// GetUserLikesCommentListById 获取用户点赞评论列表
func GetUserLikesCommentListById(userId int, p *utils.Pagination) (comments *[]model.UserComment, err error) {
	return db.GetUserLikesCommentListById(userId, p)
}
